<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>火灾信息</title>
    <link rel="stylesheet" href="js/bootstrap.min.css">
    <script src="js/jquery-1.12.4.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/alert.js"></script>
    <script type="text/javascript">
        $(function () {
            var myMsg = $("#myMsg").val();
            if(myMsg != null && myMsg !=''){
                myAlert("消息提示" , myMsg , function () {

                });
            }
            function warnFun(){
                $('#warn2').load("/local/fire")
                let warn = $("#warn").val();
                if(warn.length != 0 && warn != '无'){
                    myAlert("火灾警报" , "着火地点：" + warn, function () {
                        clearInterval(timer)
                        $('#warn2').load("/local2/fire")
                    });
                }
            }
            timer = setInterval(warnFun , 2000)

        })
    </script>
</head>
<body>
<div th:fragment="warn2" id="warn2" hidden="hidden">
    <input id="warn" th:value="${sensor}" value="无">
</div>
<div th:replace="~{common/bar :: topbar(urlActive='fire')}"></div>
<div class="container">
    <div class="row">
        <div class="col-md-1"></div>
        <div class="col-md-10" align="center">
            <table class="table table-hover table-bordered" style="margin-top: 10px">
                <thead>
                <tr>
                    <th>序号</th>
                    <th>时间</th>
                    <th>地点</th>
                    <th>状态</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="fire , index :${fireList}">
                    <td th:text="${index.index + 1}"></td>
                    <td th:text="${fire.date}"></td>
                    <td th:text="${fire.sensor.location}"></td>
                    <td th:text="${fire.status}"></td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>
<div th:replace="~{common/bar :: buttombar}"></div>
</body>
</html>